package com.iwop.moto.service.impl;

import com.iwop.moto.model.SuperRecordModel;
import com.iwop.moto.service.BaseService;
import com.iwop.moto.service.OrderAddressService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author liuwb 2016-07-29 14:01
 */
@Service
public class OrderAddressServiceImpl extends BaseService implements OrderAddressService {


    /**
     * 活动地址 - 新增
     */
    public void insertAddress(SuperRecordModel SRModel){
        getSqlSession().insert("MOrderAddressMapper.insertAddress",SRModel);
    }

    /**
     * 活动地址 - 列表
     */
    public List<SuperRecordModel> findOrderAddressByUser(SuperRecordModel SRModel){
        return getSqlSession().selectList("MOrderAddressMapper.findOrderAddressByUser",SRModel);
    }

    /**
     * 活动地址 - 用户订单评价
     */
    public SuperRecordModel findOrderAddressDetail(SuperRecordModel SRModel){
        return getSqlSession().selectOne("MOrderAddressMapper.findOrderAddressDetail",SRModel);
    }

    /**
     * 收获地址 - 修改
     */
    public void updateOrderAddressBySid(SuperRecordModel SRModel){
        getSqlSession().update("MOrderAddressMapper.updateOrderAddressBySid",SRModel);
    }

    /**
     * 收获地址 - 设为默认地址
     */
    public void updateStatusBySid(SuperRecordModel SRModel){
        getSqlSession().update("MOrderAddressMapper.updateStatusBySid",SRModel);
    }

    /**
     * 重置所有状态为正常
     */
    public void updateStatusResetByUserId(SuperRecordModel SRModel){
        getSqlSession().update("MOrderAddressMapper.updateStatusResetByUserId",SRModel);
    }

    public void deleteBySid(SuperRecordModel SRModel){
        getSqlSession().delete("MOrderAddressMapper.deleteBySid",SRModel);
    }

}
